/*
 * @Author: 刘思思
 * @Date: 2024-12-02 19:11:54
 * @LastEditors: 刘思思
 * @LastEditTime: 2024-12-03 17:16:00
 * @FilePath: /AdvertisingMachine/main/inc/adLogic.h
 * @Description: 
 * 
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. 
 */
  #ifndef AD
  #define AD
  #include "cJSON.h"
  #include<glib.h>
  #include "gio/gio.h"
  #define AD_DB_PATH "/home/lss/test/test.db"
  #define AD_SAVE_PATH "/home/lss/test/"
  #define RES_PATH "/home/lss/test/resources/"
  //上下分屏的广告机
   typedef struct AdResource
  {
     int id;
     int ad_id;
     int type_id;
     char* path;
     char* sign;
     int index;
  } AdResource;
  
 typedef struct Ad
  {
    //广告本身信息
    int id;
    int template_id;
    int customer_id;
    char* start_time;
    char* end_time;
    int state;
    int index;

    //广告资源
    AdResource *adResources[3];
  } Ad;
  void handleAdList(cJSON* adListArray);
  char* getResPath(AdResource *ar);
  int downloadAdsAndGenLocalAdListToSqlite(Ad* ads[],int size);
  #endif
  